﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Policy;

namespace broker.duty.RB
{
    class Class5
    {

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("重大疾病"))
            {
                da.Value = ppa.Amount;
                ppa.IsCurrentFinish = true;
            }
        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.HolderStates.Contains("特定疾病"))
            {
                double x = ppa.GetDutyTotalValue("特定疾病保险金");

                if (x <= double.Epsilon)
                {

                    da.Value = ppa.Amount * 0.2 > 100000 ? 100000 : ppa.Amount * 0.2;

                }
            }
        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.HolderStates.Contains("身故"))
            {
                if (ppa.Age < 18)
                {
                    da.Value = ppa.TotalFee;
                }
                else
                {
                    da.Value = ppa.Amount;
                }

                ppa.IsCurrentFinish = true;
            }
        }
    }
}
